﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace Demo.ServiceContract.Hosting
{
    class Program
    {
        static void Main(string[] args)
        {
            #region Demo operation overloading
            //ServiceHost host = new ServiceHost(typeof(Demo.OperationOverloading.CalculatorService), new Uri("net.tcp://localhost:8000/"));

            //host.Description.Behaviors.Add(new ServiceMetadataBehavior());
            //host.AddServiceEndpoint(typeof(Demo.OperationOverloading.ICalculator), new NetTcpBinding(), "");
            //host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex");

            //host.Open();
            //Console.Write("Service started");
            //Console.Read();
            //host.Close();
            #endregion

            #region
            ServiceHost host = new ServiceHost(typeof(Demo.ContractInheritance.ClientContractHierarchy.ClassB), new Uri("net.tcp://localhost:8000/"));

            host.Description.Behaviors.Add(new ServiceMetadataBehavior());
            host.AddServiceEndpoint(typeof(Demo.ContractInheritance.ClientContractHierarchy.IB), new NetTcpBinding(), "");
            host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexTcpBinding(), "mex");

            host.Open();
            Console.Write("Service started");
            Console.Read();
            host.Close();
            #endregion
        }
    }
}
